-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: improve fs code example quality #46948
Conversation
347d2b3
to
7ba5500
Compare
doc/api/fs.md
Outdated
const fromDir = '/tmp/hello'; | ||
const toDir = '/tmp/world'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this imply that /tmp/hello
and /tmp/world
are directories? I think, something like
const fromDir = '/tmp/hello'; | |
const toDir = '/tmp/world'; | |
const fromPath = '/tmp/hello'; | |
const toPath = '/tmp/world'; |
or
const fromDir = '/tmp/hello'; | |
const toDir = '/tmp/world'; | |
const oldPath = '/tmp/hello'; | |
const newPath = '/tmp/world'; |
would be less confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree 👍 thanks!
a46a1f6
to
67da4a3
Compare
@@ -7542,6 +7546,8 @@ For example, the following is prone to error because the `fs.stat()` | |||
operation might complete before the `fs.rename()` operation: | |||
|
|||
```js | |||
const fs = require('node:fs'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would typically need to have two examples here, one ESM and one CJS. (doesn't have to block this PR from landing, but it'd need to happen at some point)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problems, once this PR lands I can work on another PR to make sure all of the fs code examples have js flavor 👌 (at the moment there are many of the examples in fs missing them)
Commit Queue failed- Loading data for nodejs/node/pull/46948 FetchError: Invalid response body while trying to fetch https://api.github.com/graphql: Premature close at consumeBody (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/node_modules/node-fetch/src/body.js:234:60) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Response.text (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/node_modules/node-fetch/src/body.js:158:18) at async Request.json (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:51:18) at async Request.query (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:109:20) at async Request.queryAll (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:136:20) at async Request.gql (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/request.js:66:22) at async PRData.getComments (file:///opt/hostedtoolcache/node/18.14.2/x64/lib/node_modules/node-core-utils/lib/pr_data.js:97:21) at async Promise.all (index 2) at async Promise.all (index 1) { type: 'system', errno: 'ERR_STREAM_PREMATURE_CLOSE', code: 'ERR_STREAM_PREMATURE_CLOSE', erroredSysCall: undefined }https://github.com/nodejs/node/actions/runs/4343149312 |
PR-URL: #46948 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Qingyu Deng <i@ayase-lab.com>
Landed in 070e773 |
PR-URL: #46948 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Qingyu Deng <i@ayase-lab.com>
PR-URL: #46948 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Qingyu Deng <i@ayase-lab.com>
PR-URL: #46948 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Qingyu Deng <i@ayase-lab.com>
highlight.js
reserved keywordsfrom
.